# -*- coding: utf-8 -*-

import requests

code2city = {"南充": "101270501", "漳州": "101230601", "涪陵": "101041400", "清远": "101281301", "青浦": "101020800",
             "黄南": "101150301", "奉节": "101041900", "北碚": "101040800", "莆田": "101230401", "佛山": "101280800",
             "武威": "101160501", "石河子": "101130301", "塔城": "101131101", "彭水": "101043200", "鹰潭": "101241101",
             "三亚": "101310201", "恩施": "101201001", "鹤岗": "101051201", "阿拉善左旗": "101081201", "崇明": "101021100",
             "鸡西": "101051101", "荣昌": "101042700", "宜宾": "101271101", "安阳": "101180201", "开县": "101041500",
             "通辽": "101080501", "宿迁": "101191301", "大连": "101070201", "津南": "101031000", "汤河口": "101011800",
             "黑河": "101050601", "榆林": "101110401", "茂名": "101282001", "阿拉尔": "101130701", "厦门": "101230201",
             "北京城区": "101012200", "阿坝": "101271901", "黄冈": "101200501", "文山": "101290601", "海北": "101150801",
             "都匀": "101260401", "揭阳": "101281901", "伊春": "101050801", "三门峡": "101181701", "儋州": "101310205",
             "柳州": "101300301", "佛爷顶": "101011700", "东莞": "101281601", "三明": "101230801", "周口": "101181401",
             "安庆": "101220601", "德宏": "101291501", "晋江": "101230509", "上饶": "101240301", "安康": "101110701",
             "海南": "101150401", "玉溪": "101290701", "保亭": "101310214", "武汉": "101200101", "池州": "101221701",
             "渝北": "101040700", "开封": "101180801", "万宁": "101310215", "内江": "101271201", "临沂": "101120901",
             "淮南": "101220401", "朝阳": "101071201", "大庆": "101050901", "陵水": "101310216", "临河": "101080801",
             "定西": "101160201", "临沧": "101291101", "吐鲁番": "101130501", "金昌": "101160601", "六安": "101221501",
             "黔阳": "101251301", "吉首": "101251501", "遵义": "101260201", "昌平": "101010700", "泰安": "101120801",
             "南通": "101190501", "淮北": "101221201", "松原": "101060801", "景德镇": "101240801", "贵阳": "101260101",
             "贵港": "101300801", "常州": "101191101", "吕梁": "101101100", "五指山": "101310222", "荆州": "101200801",
             "晋城": "101100601", "扬州": "101190601", "海口": "101310101", "林芝": "101140401", "四平": "101060401",
             "攀枝花": "101270201", "赣州": "101240701", "威海": "101121301", "荆门": "101201401", "乌鲁木齐": "101130101",
             "凯里": "101260501", "玉林": "101300901", "衡阳": "101250401", "桂林": "101300501", "红河": "101290301",
             "杭州": "101210101", "博乐": "101131601", "景洪": "101291601", "临汾": "101100701", "锡林浩特": "101080901",
             "青岛": "101120201", "沈阳": "101070101", "包头": "101080201", "广元": "101272101", "平顶山": "101180501",
             "仙桃": "101201601", "台州": "101210601", "霞云岭": "101012100", "通州": "101010600", "甘孜": "101271801",
             "垫江": "101042200", "龙岩": "101230701", "庆阳": "101160401", "保山": "101290501", "中山": "101281701",
             "武隆": "101043100", "门头沟": "101011400", "长寿": "101041000", "澄迈": "101310204", "新余": "101241001",
             "平凉": "101160301", "湖州": "101210201", "湘潭": "101250201", "阿勒泰": "101131401", "漯河": "101181501",
             "乐山": "101271401", "淮安": "101190901", "乌海": "101080301", "烟台": "101120501", "重庆": "101040100",
             "琼山": "101310102", "焦作": "101181101", "十堰": "101201101", "武清": "101030200", "呼和浩特": "101080101",
             "合肥": "101220101", "乌兰浩特": "101081101", "南宁": "101300101", "孝感": "101200401", "果洛": "101150501",
             "成都": "101270101", "海西": "101150701", "文昌": "101310212", "温州": "101210701", "延安": "101110300",
             "石柱": "101042500", "西青": "101030500", "邵阳": "101250901", "鹤壁": "101181201", "承德": "101090402",
             "日照": "101121501", "晋中": "101100401", "无锡": "101190201", "怀化": "101251201", "潮州": "101281501",
             "铜梁": "101042800", "綦江": "101043300", "常德": "101250601", "黔江": "101041100", "许昌": "101180401",
             "昌吉": "101130401", "福州": "101230101", "梁平": "101042300", "广安": "101270801", "济南": "101120101",
             "金山": "101020700", "密云": "101011300", "抚顺": "101070401", "山南": "101140301", "楚雄": "101290801",
             "潜江": "101201701", "石家庄": "101090101", "张家界": "101251101", "吉安": "101240601", "肇庆": "101280901",
             "信阳": "101180601", "太原": "101100101", "辽源": "101060701", "齐齐哈尔": "101050201", "双鸭山": "101051301",
             "苏州": "101190401", "新乡": "101180301", "永州": "101251401", "永川": "101040200", "昌江": "101310206",
             "江津": "101040500", "汕头": "101280501", "万盛": "101040600", "聊城": "101121701", "和田": "101131301",
             "日喀则": "101140201", "娄底": "101250801", "洛阳": "101180901", "防城港": "101301401", "临高": "101310203",
             "咸宁": "101200701", "盘锦": "101071301", "葫芦岛": "101071401", "钦州": "101301101", "崇左": "101300201",
             "江门": "101281101", "酒泉": "101160801", "大兴": "101011100", "定安": "101310209", "辽阳": "101071001",
             "宿州": "101220701", "衡水": "101090801", "宣城": "101221401", "梧州": "101300601", "固原": "101170401",
             "台中": "101340401", "郴州": "101250501", "城口": "101041600", "南沙岛": "101310220", "镇江": "101190301",
             "万州天城": "101041200", "忠县": "101042400", "潼南": "101042100", "本溪": "101070501", "锦州": "101070701",
             "随州": "101201301", "大兴安岭": "101050701", "商丘": "101181001", "武都": "101161001", "高雄": "101340201",
             "绍兴": "101210501", "六盘水": "101260801", "万州龙宝": "101041300", "绥化": "101050501", "吴忠": "101170301",
             "金华": "101210901", "屯昌": "101310210", "雅安": "101271701", "亳州": "101220901", "临夏": "101161101",
             "邢台": "101090901", "廊坊": "101090601", "大港": "101031200", "南川": "101040400", "昆明": "101290101",
             "深圳": "101280601", "宁波": "101210401", "奉贤": "101021000", "酉阳": "101043400", "浦东": "101021300",
             "邯郸": "101091001", "运城": "101100801", "黄石": "101200601", "琼海": "101310211", "襄樊": "101200201",
             "徐家汇": "101021200", "通化": "101060501", "衢州": "101211001", "岳阳": "101251001", "上海": "101020100",
             "潍坊": "101120601", "宁河": "101030700", "普洱": "101290901", "白城": "101060601", "资阳": "101271301",
             "连云港": "101191001", "南汇": "101020600", "曲靖": "101290401", "长治": "101100501", "湛江": "101281001",
             "哈尔滨": "101050101", "呼伦贝尔": "101081000", "渭南": "101110501", "鞍山": "101070301", "兴义": "101260906",
             "伊宁": "101131001", "汉沽": "101030800", "长沙": "101250101", "中卫": "101170501", "泸州": "101271001",
             "巴南": "101040900", "云阳": "101041700", "嘉定": "101020500", "合作": "101161201", "菏泽": "101121001",
             "德阳": "101272001", "铜仁": "101260601", "广州": "101280101", "丰台": "101010900", "马鞍山": "101220501",
             "阜阳": "101220801", "凉山": "101271601", "延吉": "101060301", "东丽": "101030400", "巫山": "101042000",
             "丹东": "101070601", "萍乡": "101240901", "兰州": "101160101", "梅州": "101280401", "乐东": "101310221",
             "嘉峪关": "101161401", "台北县": "101340101", "贺州": "101300701", "绵阳": "101270401", "海东": "101150201",
             "静海": "101030900", "遂宁": "101270701", "泉州": "101230501", "河源": "101281201", "营口": "101070801",
             "保定": "101090201", "八达岭": "101011600", "那曲": "101140601", "宜昌": "101200901", "七台河": "101051002",
             "滁州": "101221101", "朔州": "101100901", "张家口": "101090301", "铜陵": "101221301", "宝山": "101020300",
             "怒江": "101291201", "牡丹江": "101050301", "益阳": "101250700", "北海": "101301301", "宜春": "101240501",
             "白沙": "101310207", "石嘴山": "101170201", "天水": "101160901", "阳泉": "101100301", "咸阳": "101110200",
             "自贡": "101270301", "云浮": "101281401", "安顺": "101260301", "丽江": "101291401", "北京": "101010100",
             "拉萨": "101140101", "阿里": "101140701", "西安": "101110101", "宝鸡": "101110901", "西宁": "101150101",
             "丽水": "101210801", "喀什": "101130901", "驻马店": "101181601", "璧山": "101042900", "玉树": "101150601",
             "铜川": "101111001", "莱芜": "101121601", "来宾": "101300401", "昭通": "101291001", "达州": "101270601",
             "海淀": "101010200", "丰都": "101043000", "香格里拉": "101291301", "濮阳": "101181301", "芜湖": "101220301",
             "汕尾": "101282101", "阳江": "101281801", "九江": "101240201", "抚州": "101240401", "顺义": "101010400",
             "松江": "101020900", "秦皇岛": "101091101", "铁岭": "101071101", "枣庄": "101121401", "大理": "101290201",
             "德州": "101120401", "大同": "101100201", "银川": "101170101", "毕节": "101260701", "商洛": "101110601",
             "株洲": "101250301", "闵行": "101020200", "珠海": "101280701", "库尔勒": "101130601", "西沙": "101310217",
             "阜新": "101070901", "忻州": "101101001", "宝坻": "101030300", "东方": "101310202", "巴中": "101270901",
             "张掖": "101160701", "济源": "101181801", "佳木斯": "101050401", "大足": "101042600", "阿图什": "101131501",
             "泰州": "101191201", "韶关": "101280201", "淄博": "101120301", "天津": "101030100", "神农架": "101201201",
             "鄂尔多斯": "101080701", "秀山": "101043600", "南平": "101230901", "北辰": "101030600", "河池": "101301201",
             "黄山": "101221001", "唐山": "101090501", "白山": "101060901", "蚌埠": "101220201", "南昌": "101240101",
             "吉林": "101060201", "集宁": "101080401", "鄂州": "101200301", "蓟县": "101031400", "滨州": "101121101",
             "徐州": "101190801", "阿克苏": "101130801", "巢湖": "101221601", "东营": "101121201", "南阳": "101180701",
             "济宁": "101120701", "惠州": "101280301", "百色": "101301001", "房山": "101011200", "石景山": "101011000",
             "长春": "101060101", "琼中": "101310208", "哈密": "101131201", "眉山": "101271501", "巫溪": "101041800",
             "平谷": "101011500", "嘉兴": "101210301", "克拉玛依": "101130201", "汉中": "101110801", "塘沽": "101031100",
             "盐城": "101190701", "沙坪坝": "101043700", "白银": "101161301", "密云上甸子": "101011900", "合川": "101040300",
             "天门": "101201501", "怀柔": "101010500", "昌都": "101140501", "赤峰": "101080601", "斋堂": "101012000",
             "延庆": "101010800", "沧州": "101090701", "南京": "101190101", "舟山": "101211101", "郑州": "101180101",
             "宁德": "101230301"}


def inquire_weather(city_name):
    code = code2city[city_name]
    r = requests.get('http://www.weather.com.cn/adat/sk/' + code + '.html')
    print r.text
    return r.json()
